// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) ansi lnc 

package com.example.airkissdemo.Util;


public class CRC8
{

    private CRC8()
    {
    }

    public static int compute(int i)
    {
        return 0xff & dscrc_table[i & 0xff];
    }

    public static int compute(int i, int j)
    {
        return 0xff & dscrc_table[0xff & (j ^ i)];
    }

    public static int compute(byte abyte0[])
    {
        return compute(abyte0, 0, abyte0.length);
    }

    public static int compute(byte abyte0[], int i)
    {
        return compute(abyte0, 0, abyte0.length, i);
    }

    public static int compute(byte abyte0[], int i, int j)
    {
        return compute(abyte0, i, j, 0);
    }

    public static int compute(byte abyte0[], int i, int j, int k)
    {
        int l = k;
        int i1 = 0;
        do
        {
            if(i1 >= j)
                return l & 0xff;
            l = dscrc_table[0xff & (l ^ abyte0[i1 + i])];
            i1++;
        } while(true);
    }

    private static byte dscrc_table[];

    static 
    {
        int i;
        dscrc_table = new byte[256];
        i = 0;
_L2:
        if(i >= 256)
            return;
        int j = i;
        int k = 0;
        int l = 0;
        do
        {
label0:
            {
                if(l < 8)
                    break label0;
                dscrc_table[i] = (byte)k;
                i++;
            }
            if(true)
                continue;
            if((1 & (j ^ k)) == 1)
                k = 0x80 | (k ^ 0x18) >> 1;
            else
                k >>= 1;
            j >>= 1;
            l++;
        } while(true);
        if(true) goto _L2; else goto _L1
_L1:
    }
}
